#include "StdAfx.h"
#include "SRObjModel.h"

using namespace sora;
using std::string;
using std::vector;
using std::auto_ptr;


TEST(ObjModel, KeywordCategory)
{
	string line;

	line = "mtllib";
	EXPECT_EQ(ObjNodeKeywordMaterialLibrary, ObjModel::str2keyword(line));
	EXPECT_EQ(ObjNodeCategoryDisplayRenderAttribute, ObjModel::str2category(ObjModel::str2keyword(line)));

	line = "usemtl";
	EXPECT_EQ(ObjNodeKeywordMaterialName, ObjModel::str2keyword(line));
	EXPECT_EQ(ObjNodeCategoryDisplayRenderAttribute, ObjModel::str2category(ObjModel::str2keyword(line)));

	line = " ";
	EXPECT_EQ(ObjNodeKeywordNull, ObjModel::str2keyword(line));

	line = "# 0 materials";
	EXPECT_EQ(ObjNodeKeywordNull, ObjModel::str2keyword(line));

	line = "v";
	EXPECT_EQ(ObjNodeKeywordGeometricVertex, ObjModel::str2keyword(line));
	EXPECT_EQ(ObjNodeCategoryVertexData, ObjModel::str2category(ObjModel::str2keyword(line)));

	line = "vn";
	EXPECT_EQ(ObjNodeKeywordVertexNormal, ObjModel::str2keyword(line));
	EXPECT_EQ(ObjNodeCategoryVertexData, ObjModel::str2category(ObjModel::str2keyword(line)));

	line = "g";
	EXPECT_EQ(ObjNodeKeywordGroupName, ObjModel::str2keyword(line));
	EXPECT_EQ(ObjNodeCategoryGrouping, ObjModel::str2category(ObjModel::str2keyword(line)));

	line = "f";
	EXPECT_EQ(ObjNodeKeywordFace, ObjModel::str2keyword(line));
	EXPECT_EQ(ObjNodeCategoryElement, ObjModel::str2category(ObjModel::str2keyword(line)));
}
